<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Fetches a row from the result set</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ovrimos-execute.html">ovrimos_execute</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ovrimos-fetch-row.html">ovrimos_fetch_row</a></div>
 <div class="up"><a href="ref.ovrimos.html">Ovrimos SQL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ovrimos-fetch-into" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ovrimos_fetch_into</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.3, PHP 5 &lt;= 5.0.5)</p><p class="refpurpose"><span class="refname">ovrimos_fetch_into</span> &mdash; <span class="dc-title">Fetches a row from the result set</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ovrimos-fetch-into-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>ovrimos_fetch_into</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$result_id</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$result_array</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$how</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$rownumber</code></span>
  ]] )</div>

  <p class="para rdfs-comment">
   Fetches a row from the given result set, into 
   <em><code class="parameter">result_array</code></em>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ovrimos-fetch-into-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">result_id</code></em></dt>

     <dd>

      <p class="para">
       A result identifier, returned by <span class="function"><a href="function.ovrimos-execute.html" class="function">ovrimos_execute()</a></span>
       or <span class="function"><a href="function.ovrimos-exec.html" class="function">ovrimos_exec()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">result_array</code></em></dt>

     <dd>

      <p class="para">
       You must provide an array by reference. It will be filled with the
       fetched values.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">how</code></em></dt>

     <dd>

      <p class="para">
       Determines how the rows are fetched. This can be one of the following
       strings (case is not significant):
       <table class="doctable informaltable">
        
         <thead>
          <tr>
           <th>Option</th>
           <th>Notes</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><em>Next</em></td>
           <td>
            Forward direction from current position.
            This is the default value.
           </td>
          </tr>

          <tr>
           <td><em>Prev</em></td>
           <td>
            Backward direction from current position.
           </td>
          </tr>

          <tr>
           <td><em>First</em></td>
           <td>
            Forward direction from the start.
           </td>
          </tr>

          <tr>
           <td><em>Last</em></td>
           <td>
            Backward direction from the end.
           </td>
          </tr>

          <tr>
           <td><em>Absolute</em></td>
           <td>
            Absolute position from the start.
            Requires <em><code class="parameter">rownumber</code></em>. 
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">rownumber</code></em></dt>

     <dd>

      <p class="para">
       The row number, first one is 0. Only needed when 
       <em><code class="parameter">how</code></em> is set to
       <em>Absolute</em>. 
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ovrimos-fetch-into-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ovrimos-fetch-into-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2002">
    <p><strong>Example #1 A fetch into example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$conn</span><span style="color: #007700">=</span><span style="color: #0000BB">ovrimos_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"neptune"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"8001"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"admin"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">!=</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Connection&nbsp;ok!"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$res</span><span style="color: #007700">=</span><span style="color: #0000BB">ovrimos_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"select&nbsp;table_id,&nbsp;table_name&nbsp;from&nbsp;sys.tables"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$res&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Statement&nbsp;ok!"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">ovrimos_fetch_into</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list(</span><span style="color: #0000BB">$table_id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$table_name</span><span style="color: #007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"table_id="&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$table_id&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">",&nbsp;table_name="&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$table_name&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">ovrimos_fetch_into</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list(</span><span style="color: #0000BB">$table_id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$table_name</span><span style="color: #007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"table_id="&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$table_id&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">",&nbsp;table_name="&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$table_name&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Next:&nbsp;error\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"First:&nbsp;error\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ovrimos_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ovrimos_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ovrimos-fetch-into-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.ovrimos-fetch-row.html" class="function" rel="rdfs-seeAlso">ovrimos_fetch_row()</a> - Fetches a row from the result set</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ovrimos-execute.html">ovrimos_execute</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ovrimos-fetch-row.html">ovrimos_fetch_row</a></div>
 <div class="up"><a href="ref.ovrimos.html">Ovrimos SQL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
